package com.qinggeng.project.tool.pay.service;

import com.qinggeng.project.system.domain.UserWallet;
import com.qinggeng.project.tool.pay.domain.AliWithdrawModal;
import com.qinggeng.project.tool.pay.domain.vo.TradeVo;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;

/**
 * 支付宝工具
 */
public interface AliPayService {

    /**
     * 处理来自PC的交易请求
     * @param tradeVo 交易详情
     * @return
     */
    public String toPayAsWeb(TradeVo tradeVo) throws Exception;

    /**
     * 处理来自APP的交易请求
     * @param tradeVo 交易详情
     * @return /
     * @throws Exception
     */
    public String toPayAsApp(TradeVo tradeVo) throws Exception;


    /**
     * 处理来自APP的交易请求
     * @param tradeVo 交易详情
     * @return /
     * @throws Exception
     */
    public String toCyclePayAsApp(TradeVo tradeVo) throws Exception;

    /**
     * 支付宝周期扣款签约
     * @param
     * @return /
     * @throws Exception
     */
    public String sign(Long id) throws Exception;



    /**
     * 处理来自扫码的交易请求
     * @param tradeVo 交易详情
     * @return /
     * @throws Exception
     */
    public String toPayAsScan(TradeVo tradeVo) throws Exception;
    /**
     * 校验签名
     * @param request HttpServletRequest
     * @return /
     */
    public boolean rsaCheck(HttpServletRequest request);

    /**
     * 回调
     * @param parameterMap 回调信息
     */
    public boolean notifyCallback(Map<String, String[]> parameterMap);

    /**
     * 退款
     * @param ordersNo 订单编号
     * @param refundAmount 退款金额
     */
    void refund(String ordersNo, BigDecimal refundAmount) throws Exception;

    /**
     * 单商品退款
     * @param ordersNo
     * @param ordersGoodsId
     * @param refundAmount
     * @throws Exception
     */
    String refund(String ordersNo,Long ordersGoodsId, BigDecimal refundAmount) throws Exception;

    /**
     * 提现
     * @param modal 提现模型
     * @return
     */
    boolean tixian(AliWithdrawModal modal, UserWallet userWallet);

    /**
     * gsd提现
     * @param modal
     */
    boolean withdrawal(AliWithdrawModal modal);


}
